package com.edu.zut.hb.software.server.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.edu.zut.hb.software.server.pojo.Student;
import com.edu.zut.hb.software.server.service.IStudentService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *     前端服务器
 * </p>
 * @author 86176
 * @since 2021-8-24
 */
@RestController
@RequestMapping("/clazz")
public class ClassmateController {
    @Autowired
    private IStudentService studentService;
    @ApiOperation(value = "获取班级学生数据")
    @GetMapping(value = "/{clazz}")
    public List<Student> getOneClassmate(@PathVariable("clazz") String clazz){
        return studentService.getOneClassmate(clazz);}

    @ApiOperation(value = "获取所有学生")
    @GetMapping("/")
    public List<Student> getAllStudent() {
        return studentService.list(new QueryWrapper<Student>().last("limit 50"));
    }
}
